package com.lanqiao.guimei.dao;

import com.lanqiao.guimei.vo.Stock;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.log4j.Logger;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * 库存表CUDR
 * @author stone(huangshizhang) at 2019-08-17 22:14
 */
public class StockDao extends BaseDao {

    Logger logger = Logger.getLogger(StockDao.class);

    /**
     * 查找所有的库存
     *
     * @return
     */
    public List<Stock> findAll(){
        try {
            return runner.query("select STK_ID stkId,STK_NAME stkName,QUANTITY,IN_STK_DATE inStkDate, OUT_STK_DATE outStkDate from STOCK"
                    , new BeanListHandler<>(Stock.class));
        } catch (SQLException e) {
            logger.error("查询所有库存失败：" + e);
        }
        return null;
    }
}
